/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

@import url("./spectrum-checkmark.css");
@import url("./spectrum-chevron.css");
@import url("./spectrum-menu-item.css");
@import url("./menu-item-overrides.css");

:host {
    text-align: initial;
}

:host([hidden]) {
    display: none;
}

:host([disabled]) {
    pointer-events: none;
}

:host([disabled]) [name="value"]::slotted(*) {
    color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
}

:host([has-submenu][disabled]) .chevron {
    color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled)));
}

#button {
    position: absolute;
    inset: 0;
}

:host([dir="ltr"]) [icon-only]::slotted(:last-of-type) {
    margin-right: auto;
}

:host([dir="rtl"]) [icon-only]::slotted(:last-of-type) {
    margin-left: auto;
}

/* N: Manually adding this selector because I can't use this selector in
** spectrum-menu.css without touching all the other `.spectrum-Menu-item`s in
** that file which I don't want to surface
*/
@media (forced-colors: active) {
    :host {
        forced-color-adjust: none;
    }
}

::slotted([slot="submenu"]) {
    width: max-content;
    max-width: 100%;
    overflow-y: auto;
}

:host([no-wrap]) #label {
    display: block;
}

/** Host is :focus bt not :focus-visible so we remove the outline */
:host([focused]:not(:focus-visible)) {
    outline: none;
    box-shadow: none;
}
